package com.lcy.demo;

import java.rmi.NotBoundException;
import java.rmi.RemoteException;
import java.rmi.registry.LocateRegistry;
import java.rmi.registry.Registry;

/**
 * Created by 娄存银 on 2017/4/6.
 */
public class Client {
    public static void main(String[] args){
        try {
            Registry registry = LocateRegistry.getRegistry(20036);
            RemoteService service = (RemoteService) registry.lookup("demoService");
            if(service != null){
                String msg = service.sayHello("client");
                System.out.println(msg);
            }
        } catch (RemoteException | NotBoundException e) {
            e.printStackTrace();
        }
    }
}
